package strategy;

/**
 * 功能:
 * 作者: ldl
 * 时间: 2016-08-15 16:47
 */
public class Context {

    private Strategy strategy;

    public Context(String type) {
        String className = "strategy." + type;
        try {
            strategy = (Strategy) Class.forName(className).newInstance();
        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
            e.printStackTrace();
        }
    }

    public void ContextInterface() {
        strategy.algorithmInterface();
    }

}
